package com.adou.d16.oos;

import java.io.FileOutputStream;

import java.io.ObjectOutputStream;

public class OOSTest1 {
    public static void main(String[] args) {
        // 1.创建一个对象
        Student stu = new Student("admin", "张三", 23, "123456");

        // 2.创建一个对象输出流
        try(final ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("d1-helloword-app\\src\\it12_out.txt"));) {
            // 3.序列号对象到文件中
            oos.writeObject(stu);

            System.out.println("序列化成功");

        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
